import React, { Component } from "react";
import {
  Router,
  HashRouter,
  BrowserRouter,
  Link,
  NavLink,
  Route,
  Switch,
  Redirect
} from "react-router-dom";
import { Row, Col, Table, Tooltip, Card, Icon, Radio } from "antd/lib/index";
import "antd/dist/antd.less";
import loadable from './utils/loadable'
// import { Link } from 'dva/router'


const BlankLayout = loadable(() => import("./layouts/BlankLayout"));
const BasicLayout = loadable(() => import("./layouts/BasicLayout"));
const UserLayout = loadable(() => import("./layouts/UserLayout"));


const MiddleBackStage = loadable(() => import("./pages/ant-landing/middle-back-stage"));
const FoundationTemplate = loadable(() => import("./pages/ant-landing/foundation-template"));
const SeeconfWebsite = loadable(() => import("./pages/ant-landing/seeconf-website"));

// import AntsExperienceClouds from "./pages/ant-landing/ants-experience-clouds";
// import AntDesignWebsitetwo from "./pages/ant-landing/ant-design-website2.0";
// import AntDesignWebsiteThird from "./pages/ant-landing/ant-design-website3.0/Home";
// import AntDesignProTemplate from "./pages/ant-landing/ant-design-pro-template";


const Home = loadable(() => import("./pages/home"));


const Buttons = loadable(() => import("./pages/general/buttons"));
const KimIcon = loadable(() => import("./pages/general/icon"));
const Typography = loadable(() => import("./pages/general/typography"));


const Grid = loadable(() => import(/* webpackChunkName: 'ken' */ "./pages/layout/grid"));
const BasicStructure = loadable(() => import(/* webpackChunkName: 'ken' */ './pages/layout/basic-structure'));
const SiderDemo = loadable(() => import(/* webpackChunkName: 'ken' */ './pages/layout/side-roll.jsx'));


const Affix = loadable(() => import(/* webpackChunkName: 'ken' */  "./pages/navigation/affix"));
const Breadcrumb = loadable(() => import(/* webpackChunkName: 'ken' */ "./pages/navigation/breadcrumb"));
const KimDropdown = loadable(() => import(/* webpackChunkName: 'ken' */ "./pages/navigation/dropdown"));
const KimMenu = loadable(() => import(/* webpackChunkName: 'ken' */ "./pages/navigation/menu"));
const KimPagination = loadable(() => import(/* webpackChunkName: 'ken' */ "./pages/navigation/pagination"));
const KimPageHeader = loadable(() => import(/* webpackChunkName: 'ken' */ "./pages/navigation/page-header"));
const KimSteps = loadable(() => import(/* webpackChunkName: 'ken' */ "./pages/navigation/steps"));


const dataentryAutoComplete = loadable(() => import("./pages/dataentry/auto-complete"));
const dataentryCheckbox = loadable(() => import("./pages/dataentry/checkbox"));
const dataentryCascader = loadable(() => import("./pages/dataentry/cascader"));
const dataentryDatePicker = loadable(() => import("./pages/dataentry/date-picker"));
const dataentryInputNumber = loadable(() => import("./pages/dataentry/input-number"));
const dataentryForm = loadable(() => import("./pages/dataentry/form"));
const dataentryInput = loadable(() => import("./pages/dataentry/input"));
const dataentryMentions = loadable(() => import("./pages/dataentry/mentions"));
const dataentryRate = loadable(() => import("./pages/dataentry/rate"));
const dataentryRadio = loadable(() => import("./pages/dataentry/radio"));
const dataentrySwitch = loadable(() => import("./pages/dataentry/switch"));
const dataentrySelect = loadable(() => import("./pages/dataentry/select"));
const dataentryTreeSelect = loadable(() => import("./pages/dataentry/tree-select"));
const dataentryTransfer = loadable(() => import("./pages/dataentry/transfer"));
const dataentryTimePicker = loadable(() => import("./pages/dataentry/time-picker"));
const dataentrySlider = loadable(() => import("./pages/dataentry/slider"));
const dataentryUpload = loadable(() => import("./pages/dataentry/upload"));

const datadisplayAvatar = loadable(() => import("./pages/datadisplay/avatar"));
const datadisplayBadge = loadable(() => import("./pages/datadisplay/badge"));
const datadisplayCalendar = loadable(() => import("./pages/datadisplay/calendar"));
const datadisplayCard = loadable(() => import("./pages/datadisplay/card"));
const datadisplayCarousel = loadable(() => import("./pages/datadisplay/carousel"));


const manyConditionsColumn = loadable(() => import("./pages/dataentry/many-conditions-column"));
const Modals = loadable(() => import("./pages/ui/modals"));
const Loadings = loadable(() => import("./pages/ui/loadings"));
const Notice = loadable(() => import("./pages/ui/notification"));
const Messages = loadable(() => import("./pages/ui/messages"));
const Gallery = loadable(() => import("./pages/ui/gallery"));
const Carousel = loadable(() => import("./pages/ui/carousel"));


const NoMatch = loadable(() => import("./pages/nomatch/nomatch"));


const Tabs = loadable(() => import("./pages/data-presentation/tabs"));
const Tree = loadable(() => import("./pages/data-presentation/tree"));
const Empty = loadable(() => import("./pages/data-presentation/empty"));

const FormLogin = loadable(() => import("./pages/form/login"));
const FormRegister = loadable(() => import("./pages/form/register"));
const FormRegister2 = loadable(() => import("./pages/form/register2"));
const CustomizedForm = loadable(() => import("./pages/form/customized-form"));



const DemoTable = loadable(() => import("./pages/table/demoTable"));
const BasicTable = loadable(() => import("./pages/table/basicTable"));
const HighTable = loadable(() => import("./pages/table/highTable"));

const City = loadable(() => import("./pages/city/city"));
const Rich = loadable(() => import('./pages/rich/rich'));

const Common = loadable(() => import('./layouts/Common'));
const OrderDetail = loadable(() => import('./pages/order/detail'));


const Employee = loadable(() => import('./pages/employee/employee-manage'));
const Upload = loadable(() => import('./pages/network/download'));

const BikeMap = loadable(() => import('./pages/map/bikeMap'));
const Bar = loadable(() => import('./pages/echarts/bar'));
const Pie = loadable(() => import('./pages/echarts/pie'));
const Line = loadable(() => import('./pages/echarts/line'));
const Permission = loadable(() => import('./pages/permission'));
const Order = loadable(() => import('./pages/order/order'));

export default class Irouter extends Component {
  constructor(props) {
    super(props);
    this.state = {};
  }

  render() {
    return (
      <HashRouter>
        <BlankLayout>
          <Switch>
            <Route path="/login" component={UserLayout} />
            <Route path="/ant-landing" render={() =>
              <Switch>
                <Route path="/ant-landing/middle-back-stage" component={MiddleBackStage} />
                <Route path="/ant-landing/foundation-template" component={FoundationTemplate} />
                <Route path="/ant-landing/seeconf-website" component={SeeconfWebsite} />
                {/* <Route path="/ant-landing/ants-experience-clouds" component={AntsExperienceClouds} />
                <Route path="/ant-landing/ant-design-website2.0" component={AntDesignWebsitetwo} />
                <Route path="/ant-landing/ant-design-website3.0" component={AntDesignWebsiteThird} />
              <Route path="/ant-landing/ant-design-pro-template" component={AntDesignProTemplate} /> */}
                <Redirect to="/ant-landing/foundation-template" />
              </Switch>
            } />

            <Route path="/common" render={() =>
              <Common>
                <Route path="/common/order/detail/:orderId" component={OrderDetail} />
              </Common>
            } />

            <Route
              path="/"
              // exact={true} //todo kim-stamp 精准定位
              render={() => (
                <BasicLayout>
                  <Switch>
                    <Route path="/home" component={Home} />
                    {/* 通用 */}
                    <Route path="/general/button" component={Buttons} />
                    <Route path="/general/icon" component={KimIcon} />
                    <Route path="/general/typography" component={Typography} />
                    {/* 布局 */}
                    <Route path="/layout/grid" component={Grid} />
                    {/* 导航 */}
                    <Route path="/navigation/affix" component={Affix} />
                    <Route path="/navigation/breadcrumb" component={Breadcrumb} />
                    <Route path="/navigation/dropdown" component={KimDropdown} />
                    <Route path="/navigation/menu" component={KimMenu} />
                    <Route path="/navigation/pagination" component={KimPagination} />
                    <Route path="/navigation/page-header" component={KimPageHeader} />
                    <Route path="/navigation/steps" component={KimSteps} />

                    <Route path="/ui/modals" component={Modals} />
                    <Route path="/ui/loadings" component={Loadings} />
                    <Route path="/ui/notification" component={Notice} />
                    <Route path="/ui/messages" component={Messages} />
                    <Route path="/ui/gallery" component={Gallery} />
                    <Route path="/ui/carousel" component={Carousel} />
                    <Route path="/form/login" component={FormLogin} />
                    <Route path="/form/register" component={FormRegister} />
                    <Route path="/form/register2" component={FormRegister2} />
                    <Route path="/form/customized-form" component={CustomizedForm} />
                    <Route path="/layout/side-roll" component={SiderDemo} />
                    <Route path="/layout/basic-structure" component={BasicStructure} />
                    {/* 数据录入 */}
                    <Route path="/dataentry/auto-complete" component={dataentryAutoComplete} />
                    <Route path="/dataentry/cascader" component={dataentryCascader} />
                    <Route path="/dataentry/checkbox" component={dataentryCheckbox} />
                    <Route path="/dataentry/date-picker" component={dataentryDatePicker} />
                    <Route path="/dataentry/input-number" component={dataentryInputNumber} />
                    <Route path="/dataentry/mentions" component={dataentryMentions} />
                    <Route path="/dataentry/rate" component={dataentryRate} />
                    <Route path="/dataentry/radio" component={dataentryRadio} />
                    <Route path="/dataentry/switch" component={dataentrySwitch} />
                    <Route path="/dataentry/form" component={dataentryForm} />
                    <Route path="/dataentry/select" component={dataentrySelect} />
                    <Route path="/dataentry/input" component={dataentryInput} />
                    <Route path="/dataentry/many-conditions-column" component={manyConditionsColumn} />
                    <Route path="/dataentry/tree-select" component={dataentryTreeSelect} />
                    <Route path="/dataentry/transfer" component={dataentryTransfer} />
                    <Route path="/dataentry/time-picker" component={dataentryTimePicker} />
                    <Route path="/dataentry/slider" component={dataentrySlider} />
                    <Route path="/dataentry/upload" component={dataentryUpload} />

                    <Route path="/datadisplay/avatar" component={datadisplayAvatar} />
                    <Route path="/datadisplay/badge" component={datadisplayBadge} />
                    <Route path="/datadisplay/calendar" component={datadisplayCalendar} />
                    <Route path="/datadisplay/card" component={datadisplayCard} />
                    <Route path="/datadisplay/carousel" component={datadisplayCarousel} />

                    {/* 数据展示 */}
                    <Route path="/data-presentation/tabs" component={Tabs} />
                    <Route path="/data-presentation/tree" component={Tree} />
                    <Route path="/data-presentation/empty" component={Empty} />
                    <Route path="/table/demo" component={DemoTable} />
                    <Route path="/table/basic" component={BasicTable} />
                    <Route path="/table/high" component={HighTable} />
                    <Route path="/city" component={City} />
                    <Route path="/rich" component={Rich} />
                    <Route path="/order" component={Order} />
                    <Route path="/network" component={Upload} />
                    <Route path="/employee" component={Employee} />
                    <Route path="/bikeMap" component={BikeMap} />
                    <Route path="/echarts/bar" component={Bar} />
                    <Route path="/echarts/pie" component={Pie} />
                    <Route path="/echarts/line" component={Line} />
                    <Route path="/permission" component={Permission} />
                    <Route path="/404" component={NoMatch} />
                    <Redirect to="/404" component={NoMatch} />
                    {/* <Route component={NoMatch} /> */}
                  </Switch>
                </BasicLayout>
              )}
            />
          </Switch>
        </BlankLayout>
      </HashRouter>
    );
  }
}

//  export default connect()(router)
